<template>
  <el-dialog title="二维码" :visible="dialogVisible" width="25%" @close="close">
    <el-row type="flex" justify="center">
      <canvas ref="ca" />
    </el-row>
  </el-dialog>
</template>

<script>
import qc from 'qrcode'
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    // 生成二维码函数
    async draw (url) {
      await this.$nextTick()
      qc.toCanvas(this.$refs.ca, url)
    },
    // 弹框的显示与隐藏
    close () {
      this.$emit('update:dialogVisible', false)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
